using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Cubeltem : MonoBehaviour
{
    public Image imageIcon;
    //定义xy位置索引
    private int xIndex;
    private int yIndex;
    private int iconIndex;

    private void Awake()
    {
        imageIcon = GetComponent<Image>();
    }

    public void Init(int xIndex, int yIndex, int iconIndex)
    {
        xIndex = xIndex;
        yIndex = yIndex;
        SetIcon(iconIndex);
    }
    
    public void SetIcon(int iconIndex)
    {
        this.iconIndex = iconIndex;
        //此处可以改成热加载图片
        imageIcon.sprite = Resources.Load<Sprite>("ResImages/Cubes/cube_" + iconIndex);
    }
    
    public void OnItemClicked()
    {
        GameRoot.Instance.FightWindow.OnItemClicked(this);
        
    }
}
